<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery3.3.1.js"></script>
    <style>
        li{height:30px;margin: 10px;}
    </style>
</head>
<body>
    <ul></ul>
    <input type="button" value="添加节点">
    <script>
        var i=0;
        $(function(){
            $('input').click(function(){
                i++;
                var $createLi=$("<li>"+i+"<a href='#'>删除</a></li>");
                $("ul").append($createLi);
                // 删除li
                $("li a").click(function(){
                    $(this).parent().remove();
               })
            })
            
            
        })
    </script>
</body>
</html>